import { PageContainer } from '@ant-design/pro-components';
import UserForm from "./components/userForm"
import {useState,useEffect} from "react";
import {addUserApi} from "@/services/user";
import { history } from 'umi';

import {message} from "antd"
export default function Adduser(){
    // 编辑用户页面 不显示在侧边栏
    // const navigator = useNavigate()
    const [useInfo,setUseInfo] = useState({
    })
    function submit(target){
      // 将表单提交
      addUserApi(target).then(res=>{
        console.log(res,"打印看看")
      });
      // 跳转首页
      history.push('/user/userList');
      message.success('新增成功')
    }
    return (
        <PageContainer header={{
            breadcrumb: {
              items: [
                {
                  title: '用户',
                },
                {
                  title: '新增用户',
                },
              ],
            },
          }} >
              <UserForm type="add" initData={useInfo} submit={submit}></UserForm>

          </PageContainer>
    )
}